package ru.nsu.fit.client.core.log_manager.realization;

import ru.nsu.fit.client.core.log_manager.interfaces.ILogManager;
import ru.nsu.fit.client.core.log_manager.interfaces.ILogger;

public class KernelLogManager implements ILogManager {
	private static ILogger logger = new DefaultKernelLogger();

    @Override
    public void setLogger(ILogger newLogger) {
        staticSetLogger(newLogger);
    }

    @Override
    public ILogger getLogger() {
        return staticGetLogger();
    }

//=============================================================================
//-----------------PUBLIC STATIC METHODS---------------------------------------
    public static void print(String message) {
        logger.printInfo(message);
    }

    public static void printf(String format, Object ... params) {
        logger.printInfo(String.format(format, params));
    }

    public static void staticSetLogger(ILogger newLogger) {
        if (newLogger == null)
            return;

        logger = newLogger;
    }

    public static ILogger staticGetLogger() {
        return logger;
    }
}
